
#include "stdafx.h"
//#include "VerySmallData.h"
//#include "DisbalancedTreeTest.h"
//#include "CriticalPathTest.h"

using namespace System;
using namespace ttg_internal::utils;

int main(array<System::String ^> ^args)
{
	//try
	{
		/*ttg::services::ServiceBase::getRef()->start();
		PerfLogger logger;
		logger.AddTest("CPU_Model", gcnew String(ttg::services::CPUAnalyzer::getRef()->getCPUInfo()));

		//-------------------
		//--- Exp(x) test ---
		//-------------------
		printf("Exp(x) test ... ");
		logger.AddTest("Exp_Test", "Finds exp as Taylor sum. " +
								   "Each arithmetic operation is implemented as separate pipeline node");
		//Preparing axes and creating table.
		array<String ^> ^thread_count = gcnew array<String ^>(System::Environment::ProcessorCount);
		for (int i = 0; i < thread_count->Length; i++)
			thread_count[i] = String::Format("{0} cores", i + 1);
		array<String ^> ^item_count = gcnew array<String ^>(5);
		for (int i = 0; i < 5; i++)
			item_count[i] = String::Format("{0} items", (i + 1) * 5);
		PerfTable ^table = logger.AddTable("ExpTable", nullptr, thread_count, item_count);
		//Filling table.
		for (int x = 0; x < thread_count->Length; x++)
			for (int y = 0; y < 5; y++)
				table->AddValue(x, y, String::Format("{0} ms", VerySmallData::expTest((y + 1) * 5, x + 1)));
		printf("Completed\n");

		//------------------------
		//--- Disbalanced Tree ---
		//------------------------
		printf("Disbalanced tree test ... ");
		logger.AddTest("Disbalanced_Tree_Test", "Does nothing useful, but in disbalanced tree. ");
		//Preparing axes and creating table.
		array<String ^> ^task_size = gcnew array<String ^>(5);
		int nodes = 0;
		for (int i = 0; i < 5; i++)
			task_size[i] = String::Format("{0} layers ({1} nodes)", 0 + (i + 1), nodes = nodes * 3 + 1);
		table = logger.AddTable("DisbalancedTreeTable", nullptr, thread_count, task_size);
		//Filling table.
		for (int x = 0; x < thread_count->Length; x++)
			for (int y = 0; y < 5; y++)
				table->AddValue(x, y, String::Format("{0} ms", DisbalancedTreeTest::perform(0 + (y + 1), x + 1)));
		printf("Completed\n");
		logger.Save("BasicPerfTests");

		//--------------------------
		//--- Critical path test ---
		//--------------------------
		printf("Critical path test ... ");
		logger.AddTest("Critical_Path_Test", "Does nothing useful, but with blinking critical path.");
		//Preparing axes and creating table.
		task_size = gcnew array<String ^>(3);
		for (int i = 0; i < 3; i++)
			task_size[i] = String::Format("{0}", i + 1);
		table = logger.AddTable("CriticalPathTable", nullptr, thread_count, task_size);
		//Filling table.
		for (int x = 0; x < thread_count->Length; x++)
			for (int y = 0; y < 3; y++)
				table->AddValue(x, y, String::Format("{0} ms", CriticalPathTest::perform(y + 1, x + 1)));
		printf("Completed\n");
		logger.Save("BasicPerfTests");*/
	}
	//catch (ttg::Error err)
	{
		//printf("Error: %s\n", err.toString());
	}
    return 0;
}
